<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
前端接口
*/

$router->get('/', function () use ($router) {
	return $router->app->version();
});


$router->group(['middleware' => ['web']], function ($router) {
	$router->get('/test', function () use ($router) {
		return $router->app->version();
	});
});

$router->group(['/'], function ($router) {
	$router->get('/welcome', [
		'as' => 'index',
		'uses' => 'HomeController@index'
	]);
    $router->get('/shopindex', [
        'as' => 'shopindex',
        'uses' => 'HomeController@shopindex'
    ]);
    $router->get('/footer', [
        'as' => 'footerCateList',
        'uses' => 'HomeController@footerCateList'
    ]);

    $router->get('/searchProduct', [
       'as' => 'searchProduct',
       'uses' => 'HomeController@searchProduct'
    ]);

    $router->get('/updateSearchProduct', [
        'as' => 'updateSearchProduct',
        'uses' => 'HomeController@updateSearchProduct'
     ]);


	$router->get('/example', [
		'as' => 'index',
		'uses' => 'ExampleController@index'
	]);

    $router->post('/guestbook', [
        'as' => 'guestbook',
        'uses' => 'GuestbookController@store'
    ]);


});

// IM 服务端
$router->group(['prefix' => 'im', 'namespace' => 'Im','middleware' =>  ['CORS']], function ($router) {
    //Route::resource('/login', 'ImController');
    $router->post('/login/account', 'ImController@loginAccount'); // 账号密码登录
    $router->post('/login', 'ImController@login'); // 自动登录发起会话
    $router->post('/create', 'ImController@store'); // 创建云信ID
    $router->post('/saveImContent', 'ImController@saveImContent'); // 创建云信ID
    $router->post('/record', 'ImController@recordRelation'); // 记录聊天对话的用户
    $router->get('/getImInfo/{id:\d+}', 'ImController@getImInfo'); // 储存聊天记录
    $router->post('/shopImCheck/{id:\d+}', 'ImController@userImCheck'); // 店铺 IM 账号检测
    $router->post('/updateImInfo', 'ImController@update'); // 更新 IM
});
// 公用API访问接口
$router->group(['/'], function () use ($router) {

    $router->get('sendmessage', ['uses' => 'PublicApiController@sendMessage','as' => 'web.sendmessage']);//短信发送
    $router->get('senditemsmessage', ['uses' => 'PublicApiController@sendItemsMessage','as' => 'web.senditemsmessage']);//配单短信通知发送
    $router->get('verifycode', ['uses' => 'PublicApiController@verifyCode','as' => 'web.verifycode']);//检验短信验证码是否正确
    $router->get('sendemail', ['uses' => 'PublicApiController@sendEmail','as' => 'web.sendemail']);//邮件发送
    $router->get('verifyemailcode', ['uses' => 'PublicApiController@verifyEmailCode','as' => 'web.verifyemailcode']);//检验邮件验证码是否正确
    $router->get('getlistaddress/{parent_id:\d+}', ['uses' => 'RegionsController@getListAddress','as' => 'web.getlistaddress']);//通过父类ID查询旗下地区列表

});

// 用户登录注册模块
$router->group(['namespace' => 'User'], function () use ($router) {

    $router->get('user/login', ['uses' => 'UserController@login', 'as' => 'web.user.login']);//登录验证
    $router->get('user/messageslogin', ['uses' => 'UserController@messagesLogin', 'as' => 'web.user.messageslogin']);//短信直接登录
    $router->post('im/verify', ['uses' => 'UserController@verify_im', 'as' => 'web.user.login']);//验证是否需要注册账号
    $router->get('user/checkphone', ['uses' => 'UserController@checkphone', 'as' => 'web.user.checkphone']);//验证手机号码是否存在
    $router->get('user/checkusername', ['uses' => 'UserController@checkUserName', 'as' => 'web.user.checkusername']);//验证用户名是否存在
    $router->get('user/backpwd', ['uses' => 'UserController@backPwd', 'as' => 'web.user.backpwd']);//找回密码
    $router->post('user/companyregister', ['uses' => 'UserController@companyRegister', 'as' => 'web.user.companyregister']);//企业注册
    $router->post('user/companyregisternew', ['uses' => 'UserController@companyRegisterNew', 'as' => 'web.user.companyregisternew']);//企业注册新版
    $router->post('user/personalregister', ['uses' => 'UserController@personalRegister', 'as' => 'web.user.personalregister']);//个人注册
});


$router->group(['prefix' => 'cate', 'middleware' => []], function () use ($router) {
    $router->get('/', ['uses' => 'CategoryController@index', 'as' => 'web.category.index']);
    $router->get('/{cate_id:\d+}', ['uses' => 'CategoryController@show', 'as' => 'web.category.show']);

});

$router->group(['prefix' => 'product', 'middleware' => []], function () use ($router) {
    $router->get('/', ['uses' => 'ProductsController@index', 'as' => 'web.product.index']);
    $router->get('/comments/{product_id:\d+}', ['uses' => 'ProductsController@indexProductsComments', 'as' => 'web.product.comments']);

    $router->get('/{product_id:\d+}', ['uses' => 'ProductsController@show', 'as' => 'web.product.show']);

});



//需要登陆验证的API
$router->group(['middleware' =>  ['FrontAuthenticate']],function() use ($router) {
        //会员中心我的E井
        $router->group(['namespace' => 'Member', 'prefix' => 'member', 'middleware' => []], function () use ($router) {
            $router->get('member/{user_id:\d+}', ['uses' => 'MemberController@show', 'as' => 'web.member.member.show']);//单个会员详细信息查询
            $router->put('member/{user_id:\d+}', ['uses' => 'MemberController@update', 'as' => 'web.member.member.update']);//单个会员详细信息修改
            $router->get('member/send', ['uses' => 'MemberController@send', 'as' => 'web.member.member.send']);//邮件发送

            $router->get('member/shop', ['uses' => 'MemberController@shop', 'as' => 'web.member.member.shop']);//店铺认证
            $router->get('member/shop_auth', ['uses' => 'MemberController@shop_auth', 'as' => 'web.member.member.shop_auth']);//店铺认证

        });


        //卖家中心--公司管理
        $router->group(['namespace' => 'Seller', 'middleware' => []], function () use ($router) {

            $router->get('seller/companymaterial/{user_id:\d+}/showusercompany', ['uses' => 'CompanyMaterialController@showUserCompany', 'as' => 'web.companymaterial.showusercompany']);    //通过user_id查询公司一些信息
            $router->post('seller/companymaterial/savecompanymaterial', ['uses' => 'CompanyMaterialController@saveCompanyMaterial', 'as' => 'web.companymaterial.savecompanymaterial']);    //公司基本信息保存
            $router->post('seller/company/savecompany', ['uses' => 'CompanyController@saveCompany', 'as' => 'web.company.savecompany']);    //企业认证
            $router->post('seller/company/checkcompanymoney', ['uses' => 'CompanyController@checkCompanyMoney', 'as' => 'web.company.checkcompanymoney']);    //企业认证第二步打款信息验证
            $router->get('seller/company/summery', ['uses' => 'CompanyController@summery', 'as' => 'web.company.summery']);   
        });

            $router->group(['namespace' => 'Seller', 'prefix' => 'seller/ejbao', 'middleware' => []], function () use ($router) {
                $router->get('/', ['uses' => 'ReceivingAccountController@index', 'as' => 'web.seller.ejbao.index']);
                $router->get('/{account_id:\d+}', ['uses' => 'ReceivingAccountController@show', 'as' => 'web.seller.ejbao.show']);
                $router->post('/', ['uses' => 'ReceivingAccountController@store', 'as' => 'web.seller.ejbao.store']);
                $router->put('/{account_id:\d+}', ['uses' => 'ReceivingAccountController@update', 'as' => 'web.seller.ejbao.update']);
                $router->delete('/{account_id:\d+}', ['uses' => 'ReceivingAccountController@delete', 'as' => 'web.seller.ejbao.delete']);
                $router->post('/update_default', ['uses' => 'ReceivingAccountController@updateDefault', 'as' => 'web.seller.ejbao.updateDefault']);
                $router->get('/default_account', ['uses' => 'ReceivingAccountController@getDefaultAccount', 'as' => 'web.seller.ejbao.getDefaultAccount']);
            });
            
                //资质下单
                $router->group(['namespace' => 'Seller', 'prefix' => 'seller/attribute', 'middleware' => ['FrontAuthenticate']], function () use ($router) {
                    $router->post('/{order_id:\d+}', ['uses' => 'OrderQualificationBidController@update', 'as' => 'web.seller.attribute.orders.update']);
                });
                
 
                // 用户登录注册模块
                $router->group(['namespace' => 'User'], function () use ($router) {
                    $router->get('user/checkpaypwd', ['uses' => 'UserController@checkPayPwd', 'as' => 'web.user.checkpaypwd']);//找回密码
                    $router->get('user/lastlogin', ['uses' => 'UserController@getLastLogin', 'as' => 'web.user.getLastLogin']);
                });
                    
                $router->group([ 'prefix' => 'eqbao', 'middleware' => []], function () use ($router) {
                    $router->get('/', ['uses' => 'EQBaoController@index', 'as' => 'web.eqbao.index']);
                    $router->get('/{id:\d+}', ['uses' => 'EQBaoController@show', 'as' => 'web.eqbao.show']);
                    $router->post('/', ['uses' => 'EQBaoController@store', 'as' => 'web.eqbao.store']);
                    $router->put('/{id:\d+}', ['uses' => 'EQBaoController@update', 'as' => 'web.eqbao.update']);
                    $router->delete('/{id:\d+}', ['uses' => 'EQBaoController@delete', 'as' => 'web.eqbao.delete']);
                    $router->get('/find_by_userid', ['uses' => 'EQBaoController@findByUserId', 'as' => 'web.eqbao.find_by_userid']);
                });

                $router->group(['namespace' => 'Seller', 'prefix' => 'seller/order_contract', 'middleware' => []], function () use ($router) {
                    $router->get('/', ['uses' => 'OrderContractController@index', 'as' => 'web.seller.order_contract.index']);
                    $router->get('/{id:\d+}', ['uses' => 'OrderContractController@show', 'as' => 'web.seller.order_contract.show']);
                    $router->post('/', ['uses' => 'OrderContractController@store', 'as' => 'web.seller.order_contract.store']);
                    $router->put('/{id:\d+}', ['uses' => 'OrderContractController@update', 'as' => 'web.seller.order_contract.update']);
                    $router->delete('/{id:\d+}', ['uses' => 'OrderContractController@delete', 'as' => 'web.seller.order_contract.delete']);
                    $router->get('/find_by_orderid/{order_code}', ['uses' => 'OrderContractController@findByOrderId', 'as' => 'web.seller.order_contract.find_by_orderid']);
                });
                $router->group([ 'prefix' => 'eqbao/contract', 'middleware' => []], function () use ($router) {

                    $router->get('/', ['uses' => 'OrderContractController@index', 'as' => 'web.order_contract.index']);
                    $router->get('/{id:\d+}', ['uses' => 'OrderContractController@show', 'as' => 'web.order_contract.show']);
                    $router->post('/', ['uses' => 'OrderContractController@store', 'as' => 'web.order_contract.store']);
                    $router->put('/{id:\d+}', ['uses' => 'OrderContractController@update', 'as' => 'web.order_contract.update']);
                    $router->delete('/{id:\d+}', ['uses' => 'OrderContractController@delete', 'as' => 'web.order_contract.delete']);
                    $router->get('/find_by_orderid/{order_code}', ['uses' => 'OrderContractController@findByOrderId', 'as' => 'web.order_contract.find_by_orderid']);

                });

                $router->group(['namespace' => 'Buyer', 'prefix' => 'buyer/order_contract', 'middleware' => []], function () use ($router) {
                    $router->get('/', ['uses' => 'OrderContractController@index', 'as' => 'web.buyer.order_contract.index']);
                    $router->get('/{id:\d+}', ['uses' => 'OrderContractController@show', 'as' => 'web.buyer.order_contract.show']);
                    $router->post('/', ['uses' => 'OrderContractController@store', 'as' => 'web.buyer.order_contract.store']);
                    $router->put('/{id:\d+}', ['uses' => 'OrderContractController@update', 'as' => 'web.buyer.order_contract.update']);
                    $router->delete('/{id:\d+}', ['uses' => 'OrderContractController@delete', 'as' => 'web.buyer.order_contract.delete']);
                    $router->get('/find_by_orderid/{order_code}', ['uses' => 'OrderContractController@findByOrderId', 'as' => 'web.buyer.order_contract.find_by_orderid']);
                });
                
                
                    $router->group(['namespace' => 'Seller', 'prefix' => 'seller/attrval', 'middleware' => []], function () use ($router) {
                        $router->get('/', ['uses' => 'AttributeValueController@index', 'as' => 'web.seller.attrval.index']);
                        $router->get('/{val_id:\d+}', ['uses' => 'AttributeValueController@show', 'as' => 'web.seller.attrval.show']);
                        $router->post('/', ['uses' => 'AttributeValueController@store', 'as' => 'web.seller.attrval.store']);
                        $router->delete('/{val_id:\d+}', ['uses' => 'AttributeValueController@delete', 'as' => 'web.seller.attrval.delete']);
                    });
                    
 
});
    

//买家中心订单
$router->group(['namespace' => 'Buyer', 'prefix' => 'buyer/orders', 'middleware' => ['FrontAuthenticate']], function () use ($router) {
    $router->get('/buyer_index', ['uses' => 'OrdersController@buyer_index', 'as' => 'web.buyer.orders.buyer_index']);    //买家中心最新订单
    $router->get('/', ['uses' => 'OrdersController@index', 'as' => 'web.buyer.orders.index']);    //订单列表
    $router->get('/count', ['uses' => 'OrdersController@countOrders', 'as' => 'web.buyer.orders.index']);    //订单列表
    $router->get('/{order_id:\d+}', ['uses' => 'OrdersController@show', 'as' => 'web.buyer.orders.show']);    //订单详情
    $router->post('/', ['uses' => 'OrdersController@store', 'as' => 'web.buyer.orders.store']);   //创建订单
    $router->put('/{order_id:\d+}', ['uses' => 'OrdersController@update', 'as' => 'web.buyer.orders.update']);    //更新订单：包括全量更新及部分更新

    $router->get('/group_pay/list', ['uses' => 'OrdersController@payList', 'as' => 'web.buyer.orders.group_pay.list']);    //订单组合支付列表

    //订单商品更新，评论创建
    $router->put('/{order_id:\d+}/order_products/{order_product_id:\d+}', ['uses' => 'OrdersController@updateOrderProducts', 'as' => 'web.buyer.orders.order_products.update']);

    $router->get('/{order_id:\d+}/order_express/{order_express_id}', ['uses' => 'OrdersController@showOrderExpress', 'as' => 'web.seller.orders.order_status.show']);    //订单物流查询
});

//买家中心订单商品
$router->group(['namespace' => 'Buyer', 'prefix' => 'buyer/orders/{order_id}/order_products', 'middleware' => ['FrontAuthenticate']], function () use ($router) {
    $router->get('/', ['uses' => 'OrderProductsController@index', 'as' => 'web.buyer.order_products.index']);    //订单商品列表
});

//买家中心购物车
$router->group(['namespace' => 'Buyer', 'prefix' => 'buyer/carts', 'middleware' => ['FrontAuthenticate']], function () use ($router) {
    $router->get('/', ['uses' => 'CartsController@index', 'as' => 'web.buyer.carts.index']);    //购物车列表
    $router->get('/{order_id:\d+}', ['uses' => 'CartsController@show', 'as' => 'web.buyer.carts.show']);    //购物车详情
    $router->post('/', ['uses' => 'CartsController@store', 'as' => 'web.buyer.carts.store']);   //创建购物车商品
    $router->put('/{order_id:\d+}', ['uses' => 'CartsController@update', 'as' => 'web.buyer.carts.update']);    //更新购物车：包括全量更新及部分更新
    $router->delete('/{order_id:\d+}', ['uses' => 'CartsController@delete', 'as' => 'web.buyer.carts.delete']); //删除购物车
    $router->delete('/', ['uses' => 'CartsController@batchDelete', 'as' => 'web.buyer.carts.batch_delete']); //批量删除购物车

    $router->post('/add_carts', ['uses' => 'CartsController@add_carts', 'as' => 'web.buyer.carts.add_carts']);   //cookid 数据库合并
    $router->post('/get_carts', ['uses' => 'CartsController@get_carts', 'as' => 'web.buyer.carts.get_carts']);   //获取购物车cookie数据
    $router->post('/fresh_get', ['uses' => 'CartsController@fresh_get', 'as' => 'web.buyer.carts.fresh_get']);   //重置购物车后 获取购物车cookie数据
});

//买家中心下单-商品
$router->group(['namespace' => 'Buyer', 'prefix' => 'buyer/skus', 'middleware' => ['FrontAuthenticate']], function () use ($router) {
    $router->get('/', ['uses' => 'ProductSkusController@index', 'as' => 'web.buyer.skus.index']);    //下单商品列表
    $router->get('/{order_id:\d+}', ['uses' => 'ProductSkusController@show', 'as' => 'web.buyer.skus.show']);    //下单商品详情

    $router->get('/attribute', ['uses' => 'ProductAttributesController@show', 'as' => 'web.buyer.attribute.show']);    //资质下单商品列表

});

$router->group(['namespace' => 'Buyer', 'prefix' => 'change', 'middleware' => ['FrontAuthenticate']], function () use ($router) {
    $router->get('/', ['uses' => 'ChangeController@index', 'as' => 'web.change.index']);    //退单列表
    $router->get('/{change_id}', ['uses' => 'ChangeController@show', 'as' => 'web.change.show']);    //退单详情
    $router->post('/', ['uses' => 'ChangeController@store', 'as' => 'web.change.store']);   //创建退单
    $router->put('/', ['uses' => 'ChangeController@update', 'as' => 'web.change.update']);    //更新退单：
    $router->delete('/{change_id}', ['uses' => 'ChangeController@delete', 'as' => 'web.change.delete']); //删除退单
});

$router->group(['namespace' => 'Seller', 'prefix' => 'seller/change', 'middleware' => ['FrontAuthenticate']], function () use ($router) {

    $router->get('/', ['uses' => 'ChangeController@index', 'as' => 'web.change.index']);    //退单列表
    $router->get('/{change_id}', ['uses' => 'ChangeController@show', 'as' => 'web.change.show']);    //退单详情
    $router->put('/{change_id}', ['uses' => 'ChangeController@update', 'as' => 'web.change.update']);    //更新退单：
    $router->delete('/{change_id}', ['uses' => 'ChangeController@delete', 'as' => 'web.change.delete']); //删除退单

});

//买家中心发票
$router->group(['namespace' => 'Buyer', 'prefix' => 'buyer/invoices', 'middleware' => ['FrontAuthenticate']], function () use ($router) {
    $router->get('/', ['uses' => 'UserInvoicesController@index', 'as' => 'web.buyer.invoices.index']);    //发票列表
    $router->get('/{invoice_id:\d+}', ['uses' => 'UserInvoicesController@show', 'as' => 'web.buyer.invoices.show']);    //发票详情
    $router->post('/', ['uses' => 'UserInvoicesController@store', 'as' => 'web.buyer.invoices.store']);   //创建发票
    $router->put('/{invoice_id:\d+}', ['uses' => 'UserInvoicesController@update', 'as' => 'web.buyer.invoices.update']);    //更新发票：包括全量更新及部分更新
    $router->delete('/{invoice_id:\d+}', ['uses' => 'UserInvoicesController@delete', 'as' => 'web.buyer.invoices.delete']); //删除发票
    $router->post('/check', ['uses' => 'UserInvoicesController@check', 'as' => 'web.buyer.invoices.check']); // 检测是否可继续添加发票
});

//买家中心合同信息
$router->group(['namespace' => 'Buyer', 'prefix' => 'buyer/orders/{order_id}/contracts', 'middleware' => ['FrontAuthenticate']], function () use ($router) {
    $router->get('/', ['uses' => 'UserContractsController@index', 'as' => 'web.buyer.contracts.index']);    // 买家合同信息
    // $router->get('/{order_code:\d++}', ['uses' => 'UserContractsController@show', 'as' => 'web.buyer.contracts.show']);    // 买家合同信息
});

//买家中心地址
$router->group(['namespace' => 'Buyer', 'prefix' => 'buyer/address', 'middleware' => ['FrontAuthenticate']], function () use ($router) {
    $router->get('/', ['uses' => 'AddressController@index', 'as' => 'web.buyer.address.index']);    //地址列表
    $router->get('/{address_id:\d+}', ['uses' => 'AddressController@show', 'as' => 'web.buyer.address.show']);    //地址详情
    $router->post('/', ['uses' => 'AddressController@store', 'as' => 'web.buyer.address.store']);   //创建地址
    $router->put('/{address_id:\d+}', ['uses' => 'AddressController@update', 'as' => 'web.buyer.address.update']);    //更新地址：包括全量更新及部分更新
    $router->put('/{address_id:\d+}/set_default', ['uses' => 'AddressController@updateSetDefault', 'as' => 'web.buyer.address.update.set_default']);    //设置默认值
    $router->delete('/{address_id:\d+}', ['uses' => 'AddressController@delete', 'as' => 'web.buyer.address.delete']); //删除地址
});

//买家中心我的收藏
$router->group(['namespace' => 'Buyer', 'prefix' => 'buyer/collection', 'middleware' => []], function () use ($router) {
    $router->get('/', ['uses' => 'UserCollectionController@index', 'as' => 'web.buyer.collection.index']);    //收藏列表
    $router->get('/{collect_id:\d+}', ['uses' => 'UserCollectionController@show', 'as' => 'web.buyer.collection.show']);    //收藏详情
    $router->post('/', ['uses' => 'UserCollectionController@store', 'as' => 'web.buyer.collection.store']);   // 新增收藏
    $router->put('/{collect_id:\d+}', ['uses' => 'UserCollectionController@update', 'as' => 'web.buyer.collection.update']);    //更新收藏
    $router->delete('/{collect_id:\d+}', ['uses' => 'UserCollectionController@delete', 'as' => 'web.buyer.collection.delete']); //删除收藏
    $router->post('/multiDelete', ['uses' => 'UserCollectionController@multiDelete', 'as' => 'web.buyer.collection.delete']); //删除收藏
    $router->get('/checkCollection/{sku_id:\d+}/{shop_id:\d+}', ['uses' => 'UserCollectionController@checkCollection', 'as' => 'web.buyer.collection.checkCollection']); // 获取收藏信息
    
    $router->post('/checkMultiCollection', ['uses' => 'UserCollectionController@checkMultiCollection', 'as' => 'web.buyer.collection.checkCollection']); // 获取收藏信息
});
//卖家中心合同
$router->group(['namespace' => 'Seller', 'prefix' => 'seller/contracts', 'middleware' => ['FrontAuthenticate']], function () use ($router) {
    $router->get('/', ['uses' => 'ContractsController@index', 'as' => 'web.seller.contracts.index']);    //合同列表
    $router->get('/{id:\d+}', ['uses' => 'ContractsController@show', 'as' => 'web.seller.contracts.show']);    //合同详情
    $router->post('/', ['uses' => 'ContractsController@store', 'as' => 'web.seller.contracts.store']);    //合同创建
    $router->post('/{id:\d+}', ['uses' => 'ContractsController@update', 'as' => 'web.seller.contracts.update']);    //更新订单：包括全量更新及部分更新
    $router->put('/{id:\d+}/set_default', ['uses' => 'ContractsController@updateSetDefault', 'as' => 'web.seller.contracts.update.set_default']);    //设置默认值
    $router->delete('/{id:\d+}', ['uses' => 'ContractsController@delete', 'as' => 'web.seller.contracts.delete']); //删除合同
});

//卖家 店铺banners
$router->group(['namespace' => 'Seller', 'prefix' => 'seller/banners', 'middleware' => []], function () use ($router) {
    $router->get('/', ['uses' => 'ShopBannersController@index', 'as' => 'web.seller.shop.banners.index']);    //Banners 列表
    $router->post('/', ['uses' => 'ShopBannersController@store', 'as' => 'web.seller.shop.banners.store']);    //Banners 创建
    $router->put('/{id:\d+}', ['uses' => 'ShopBannersController@update', 'as' => 'web.seller.shop.banners.update']);    //更新订单：包括全量更新及部分更新
    $router->delete('/{id:\d+}', ['uses' => 'ShopBannersController@delete', 'as' => 'web.seller.shop.banners.delete']);    //更新订单：包括全量更新及部分更新
});

//卖家中心订单
$router->group(['namespace' => 'Seller', 'prefix' => 'seller/orders', 'middleware' => ['FrontAuthenticate']], function () use ($router) {
    $router->get('/shop_index', ['uses' => 'OrdersController@shop_index', 'as' => 'web.seller.orders.shop_id']);    //卖家中心最新订单列表
    $router->get('/', ['uses' => 'OrdersController@index', 'as' => 'web.seller.orders.index']);    //订单列表
    $router->get('/seller_index', ['uses' => 'OrdersController@seller_index', 'as' => 'web.seller.orders.seller_index']);    //卖家中心最新订单列表
    $router->get('/{order_id:\d+}', ['uses' => 'OrdersController@show', 'as' => 'web.seller.orders.show']);    //订单详情
    $router->put('/{order_id:\d+}', ['uses' => 'OrdersController@update', 'as' => 'web.seller.orders.update']);    //更新订单：包括全量更新及部分更新

    //订单产品
    $router->put('/{order_id:\d+}/order_products', ['uses' => 'OrdersController@updateOrderProducts', 'as' => 'web.seller.orders.update_order_products']);    //更新订单产品：包括全量更新及部分更新
    //订单物流
    $router->post('/{order_id:\d+}/order_express', ['uses' => 'OrdersController@storeOrderExpress', 'as' => 'web.seller.orders.store_order_express']);    //创建订单物流信息
    $router->get('/{order_id:\d+}/order_express/{order_express_id}', ['uses' => 'OrdersController@showOrderExpress', 'as' => 'web.seller.orders.order_status.show']);    //订单物流查询
});

//卖家中心-买家评价
$router->group(['namespace' => 'Seller','prefix' => 'seller/orders/{order_id:\d+}/user_comment', 'middleware' => ['FrontAuthenticate']], function() use($router){
    $router->get('/', ['uses' => 'UserCommentController@index', 'as' => 'web.seller.user_comment.index']);    //卖家评价买家列表
    $router->get('/{user_comment_id:\d+}', ['uses' => 'UserCommentController@show', 'as' => 'web.seller.user_comment.show']);    //卖家评价买家详情
    $router->post('/', ['uses' => 'UserCommentController@store', 'as' => 'web.seller.user_comment.store']);   //创建卖家评价买家
});

//卖家中心合同模板
$router->group(['namespace' => 'Seller', 'prefix' => 'seller/address', 'middleware' => ['FrontAuthenticate']], function () use ($router) {
    $router->get('/', ['uses' => 'ContractsController@index', 'as' => 'web.buyer.contract.index']);    //合同模板列表
    $router->get('/{contract_id:\d+}', ['uses' => 'ContractsController@show', 'as' => 'web.buyer.contract.show']);    //合同模板详情
    $router->post('/', ['uses' => 'ContractsController@store', 'as' => 'web.buyer.contract.store']);   //创建合同模板
    $router->put('/{contract_id:\d+}', ['uses' => 'ContractsController@update', 'as' => 'web.buyer.contract.update']);    //更新合同模板：包括全量更新及部分更新
    $router->delete('/{contract_id:\d+}', ['uses' => 'ContractsController@delete', 'as' => 'web.buyer.contract.delete']); //删除合同模板
});

//卖家中心商品
    $router->group(['namespace' => 'Seller', 'prefix' => 'seller/product', 'middleware' => []], function () use ($router) {
        $router->get('/', ['uses' => 'ProductController@index', 'as' => 'web.seller.product.index']);    //订单列表
        $router->get('/count', ['uses' => 'ProductController@count', 'as' => 'web.seller.product.count']);    //商品数量
        $router->get('/{product_id:\d+}', ['uses' => 'ProductController@show', 'as' => 'web.seller.product.show']);    //订单详情

        $router->get('/cupboards', ['uses' => 'ProductController@cupboardCount', 'as' => 'web.seller.product.cupboardCount']);    //订单详情
        $router->post('/batchdel', ['uses' => 'ProductController@batchDelete', 'as' => 'web.seller.product.batchDelete']);
        $router->post('/batchsale', ['uses' => 'ProductController@batchSale', 'as' => 'web.seller.product.batchSale']);

        $router->post('/', ['uses' => 'ProductController@store', 'as' => 'web.seller.product.store']);   //创建地址
        $router->post('/{product_id:\d+}', ['uses' => 'ProductController@update', 'as' => 'web.seller.product.update']); //put 会有更新时问题  Request-URI Too Long


    });




    $router->group(['prefix' => 'shop', 'middleware' => []], function () use ($router) {
        $router->get('/', ['uses' => 'ShopController@index', 'as' => 'web.shop.index']);
        $router->get('/{shop_id:\d+}', ['uses' => 'ShopController@show', 'as' => 'web.shop.show']);

    });

   

//分类
    $router->group(['prefix' => 'attr', 'middleware' => []], function () use ($router) {
        $router->get('/', ['uses' => 'AttributeController@index', 'as' => 'web.attr.index']);
        $router->get('/{attr_id:\d+}', ['uses' => 'AttributeController@show', 'as' => 'web.attr.show']);
    });

//品牌
    $router->group(['prefix' => 'brand', 'middleware' => []], function () use ($router) {
        $router->get('/', ['uses' => 'BrandController@index', 'as' => 'web.brand.index']);
        $router->get('/{brand_id:\d+}', ['uses' => 'BrandController@show', 'as' => 'web.brand.show']);

    });

//卖家中心物流
$router->group(['namespace' => 'Seller', 'prefix' => 'seller/express_company', 'middleware' => ['FrontAuthenticate']], function () use ($router) {
    $router->get('/', ['uses' => 'ExpressCompanyController@index', 'as' => 'web.express_company.index']);    //物流公司分页
    $router->get('/kv', ['uses' => 'ExpressCompanyController@pluck', 'as' => 'web.express_company.index']);    //物流公司key=>val
    $router->get('/{id:\d+}', ['uses' => 'ExpressCompanyController@show', 'as' => 'web.express_company.show']);    //物流公司详情
});

//产品评价模块
$router->group(['namespace' => 'Buyer', 'prefix' => 'buyer/products/{product_id}/comments', 'middleware' => ['FrontAuthenticate']], function () use ($router) {
    $router->post('/', ['uses' => 'CommentsController@store', 'as' => 'web.product.comments.store']);    //产品评价
    $router->get('/sellerComment/{order_code}', ['uses' => 'CommentsController@sellerShow', 'as' => 'web.seller.CommentsController.sellerShow']); //卖家评价买家详情
    $router->get('/{id}', ['uses' => 'CommentsController@show', 'as' => 'web.product.comments.show']);    //评价详情

});



//卖家中心商铺
    $router->group(['namespace' => 'Seller', 'prefix' => 'seller', 'middleware' => []], function () use ($router) {
        $router->get('/configure', ['uses' => 'ShopController@configure', 'as' => 'web.seller.configure.configure']);    //商铺配置首页
        $router->put('/configure/{id}', ['uses' => 'ShopController@configure_update', 'as' => 'web.seller.configure.configure_update']);    //商铺配置首页

        $router->post('/get_shop', ['uses' => 'ShopController@get_shop', 'as' => 'web.seller.shop.get_shop']);    //获取店铺信息

    });
      
        
//卖家品牌申请
    $router->group(['namespace' => 'Seller', 'prefix' => 'seller', 'middleware' => []], function () use ($router) {
        $router->get('shop_brand', ['uses' => 'BrandAuditController@index', 'as' => 'web.seller.brand.index']);    //商铺品牌首页
        $router->get('shop_brand/{id}', ['uses' => 'BrandAuditController@show', 'as' => 'web.seller.brand.show']);    //商铺品牌详情
//	$router->get('/brand_add/{id}', ['uses' => 'BrandAuditController@create', 'as' => 'web.seller.brand.create']);    //商铺添加品牌页面
        $router->post('shop_brand', ['uses' => 'BrandAuditController@store', 'as' => 'web.seller.brand.store']);    //商铺添加品牌
    });




//买家我的举报
    $router->group(['namespace' => 'Buyer', 'prefix' => 'buyer', 'middleware' => []], function () use ($router) {
        $router->get('report', ['uses' => 'ReportController@index', 'as' => 'web.seller.report.index']);    //举报首页
        $router->get('report_add', ['uses' => 'ReportController@create', 'as' => 'web.seller.report.create']);    //举报添加页面
        $router->post('report', ['uses' => 'ReportController@store', 'as' => 'web.seller.report.store']);    //举报添加
    });


//店铺
    $router->group(['namespace' => 'Shop', 'prefix' => 'shop', 'middleware' => []], function () use ($router) {
        $router->get('index/{sp_id}', ['uses' => 'ShopController@show', 'as' => 'web.shop.show']);    //店铺首页公司
        $router->get('products/{sp_id}', ['uses' => 'ProductController@index', 'as' => 'web.shop.product']);    //店铺首页产品和全部产品列表页
        $router->get('products/index/{sp_id}', ['uses' => 'ProductController@shop_product', 'as' => 'web.shop.shop_product']);    //店铺首页产品和全部产品列表页
        $router->get('products_sku/{sp_id}', ['uses' => 'ProductController@sku', 'as' => 'web.shop.sku']);    //店铺首页产品和全部产品列表页
        $router->get('archives/{id}', ['uses' => 'CompanyController@show', 'as' => 'web.shop.show']);    //店铺公司档案
        $router->get('get_company/{sp_id}', ['uses' => 'ShopController@get_company', 'as' => 'web.shop.get_company']);    //获取公司id
        $router->get('third_cat/{sp_id}', ['uses' => 'ProductController@get_third_cat', 'as' => 'web.shop.get_third_cat']);    //店铺产品品类
        $router->get('categories/{sp_id}', ['uses' => 'ShopController@categories', 'as' => 'web.shop.categories']);    //店铺产品自定义分类
        $router->get('get_shop', ['uses' => 'ShopController@get_shop', 'as' => 'web.shop.get_shop']);    //获取全部店铺

        $router->get('attribute/{sp_id}', ['uses' => 'ProductController@attribute', 'as' => 'web.shop.attribute']);    //店铺资质服务列表页
        $router->get('company_show/{cmp_id}', ['uses' => 'CompanyController@company_show', 'as' => 'web.shop.company_show']);    //店铺公司信息


    });


    //卖家中心-员工管理
    $router->group(['namespace' => 'Seller', 'prefix' => 'seller/member', 'middleware' => []], function () use ($router) {
        $router->get('/auth', ['uses' => 'ShopRightMenuController@index', 'as' => 'web.member.auth']);    //员工权限

        $router->get('/', ['uses' => 'ShopEmployeeController@index', 'as' => 'web.member.index']);    //员工列表
        $router->get('/{member_id}', ['uses' => 'ShopEmployeeController@show', 'as' => 'web.member.show']);    //员工详情
        $router->post('/', ['uses' => 'ShopEmployeeController@store', 'as' => 'web.member.store']);    // 添加员工
        $router->get('/checkEmp/{phone}', ['uses' => 'ShopEmployeeController@checkEmp', 'as' => 'web.member.checkEmp']);    // 检测是否是本店的账号
        $router->put('/{member_id}', ['uses' => 'ShopEmployeeController@update', 'as' => 'web.member.update']);    //更新员工
        $router->delete('/{member_id}', ['uses' => 'ShopEmployeeController@delete', 'as' => 'web.member.delete']); //删除员工

        //员工菜单
        $router->get('/nav/{user_id}', ['uses' => 'ShopEmployeeController@nav', 'as' => 'web.member.nav']);    //员工菜单

    });





//支付
$router->group(['namespace' => 'Pay','prefix' => 'pay/czbank', 'middleware' => []], function() use($router){
    $router->post('check_order', ['uses' => 'CzbankController@checkOrder', 'as' => 'web.pay.czbank.check_order']);    //支付校验订单及生成流水号
    $router->post('notify', ['uses' => 'CzbankController@notify', 'as' => 'web.pay.czbank.notify']);    //支付回调
});

//cookie 购物车
$router->group([ 'prefix' => 'carts/carts', 'middleware' => []], function () use ($router) {
    $router->post('/', ['uses' => 'CartsController@index', 'as' => 'web.carts.index']);    //加入购物车 存cookie
    $router->delete('/', ['uses' => 'CartsController@delete', 'as' => 'web.carts.delete']);    //删除购物车 删除cookie
    $router->delete('/delete_all', ['uses' => 'CartsController@delete_all', 'as' => 'web.carts.delete_all']);    //清空购物车

});

//店铺装修-模版
$router->group(['namespace' => 'Seller', 'prefix' => 'seller/shoptemplete', 'middleware' => []], function () use ($router) {

    $router->get('/', ['uses' => 'ShopTempleteController@index', 'as' => 'web.shoptemplete.index']);    //装修-模版列表
    $router->put('/{id}', ['uses' => 'ShopTempleteController@update', 'as' => 'web.shoptemplete.update']);    //更新装修-模版

});

//店铺自定义
$router->group(['namespace' => 'Seller', 'prefix' => 'seller/shopcategories', 'middleware' => []], function () use ($router) {
    $router->get('/', ['uses' => 'ShopCategoriesController@index', 'as' => 'web.shopcategories.index']);    //装修-自定义列表
    $router->put('/{id}', ['uses' => 'ShopCategoriesController@update', 'as' => 'web.shopcategories.update']);    //更新自定义列表
    $router->post('/', ['uses' => 'ShopCategoriesController@store', 'as' => 'web.shopcategories.store']);    //自定义列表-新增
    $router->delete('/{id}', ['uses' => 'ShopCategoriesController@delete', 'as' => 'web.shopcategories.delete']);    //删除自定义列表

});

$router->post('/user/add_user', ['uses' => 'UserController@store', 'as' => 'web.user.add_user']);    //添加用户

// 自动确认订单接口
$router->group(['prefix' => 'crontabs', 'middleware' => []], function () use ($router) {
    $router->get('/', ['uses' => 'OrdersCrontabController@index', 'as' => 'web.orders.crontab.index']);    //自动确认订单-未确认列表
    $router->post('/', ['uses' => 'OrdersCrontabController@store', 'as' => 'web.orders.crontab.store']);    //自动确认订单-新增
    $router->put('/{id}', ['uses' => 'OrdersCrontabController@update', 'as' => 'web.orders.crontab.update']); //自动确认订单-执行自动确认

});

//商品sku
$router->group(['prefix' => 'skus', 'middleware' => []], function () use ($router) {
    $router->get('/', ['uses' => 'ProductSkuController@index', 'as' => 'web.skus.index']);    //sku列表
});

//商品扩展属性
$router->group(['prefix' => 'pattrs', 'middleware' => []], function () use ($router) {
    $router->get('/', ['uses' => 'ProductAttributesController@index', 'as' => 'web.pattrs.index']);    
    $router->get('/attr/{product_id}', ['uses' => 'ProductAttributesController@getByProductId', 'as' => 'web.pattrs.get_by_product_id']);     
});
    
//卖家中心首页
$router->group(['namespace' => 'Shop', 'prefix' => 'seller/index', 'middleware' => ['FrontAuthenticate']], function () use ($router) {
    $router->get('/', ['uses' => 'ShopController@shop_index', 'as' => 'web.seller.shop_index']);    //卖家中心首页
});

$router->group(['prefix' => 'article', 'middleware' => []], function () use ($router) {
    $router->get('/index_list', ['uses' => 'ArticleController@index_list', 'as' => 'web.article.index_list']); 
    $router->get('/', ['uses' => 'ArticleController@index', 'as' => 'web.article.index']);
    $router->get('/{id}', ['uses' => 'ArticleController@show', 'as' => 'web.article.show']); //商品详情页
});
$router->group(['prefix' => 'helper', 'middleware' => []], function () use ($router) {
    $router->get('/', ['uses' => 'HelperController@index', 'as' => 'web.helper.index']);// 帮助中心文章列表
    $router->get('/{id}', ['uses' => 'HelperController@show', 'as' => 'web.helper.show']); // 帮助中心文章详情
    $router->get('/cate/{id}', ['uses' => 'HelperController@getCateInfo', 'as' => 'web.helper.getCateInfo']); // 帮助中心文章详情
});

//卖家中心配单管理
$router->group(['namespace' => 'Seller', 'prefix' => 'seller/items', 'middleware' => ['FrontAuthenticate']], function () use ($router) {
    $router->get('/stock', ['uses' => 'ItemsStockController@index', 'as' => 'web.seller.items.stock']);    //
    $router->get('/items_count', ['uses' => 'ItemsInformationController@items_count', 'as' => 'web.seller.items.items_count']);    //

    $router->get('/item_shop', ['uses' => 'ShopController@item_shop', 'as' => 'web.seller.items.item_shop']);    //
    $router->get('/seller_shop/{id}', ['uses' => 'ShopController@seller_shop', 'as' => 'web.seller.items.seller_shop']);    //
    $router->get('/', ['uses' => 'ItemsInformationController@index', 'as' => 'web.seller.items.index']);    //配单管理首页
    $router->get('/{id}', ['uses' => 'ItemsInformationController@show', 'as' => 'web.seller.items.show']);    //配单详情
    $router->delete('/{id}', ['uses' => 'ItemsInformationController@destroy', 'as' => 'web.seller.items.destroy']);    //关闭配单
    $router->post('/', ['uses' => 'ItemsInformationController@store', 'as' => 'web.seller.items.store']);    //新增配单


});
// 卖家中心-服务订单
$router->group(['namespace' => 'Seller', 'prefix' => 'seller/service', 'middleware' => ['FrontAuthenticate']], function () use ($router) {
    $router->get('orders/', ['uses' => 'ServiceOrdersController@index', 'as' => 'web.seller.service.index']);
    $router->get('orders/{account_id:\d+}', ['uses' => 'ServiceOrdersController@show', 'as' => 'web.seller.service.show']);
    $router->post('orders/', ['uses' => 'ServiceOrdersController@store', 'as' => 'web.seller.service.store']);
    $router->put('orders/{account_id:\d+}', ['uses' => 'ServiceOrdersController@update', 'as' => 'web.seller.service.update']);
    $router->delete('orders/{account_id:\d+}', ['uses' => 'ServiceOrdersController@delete', 'as' => 'web.seller.service.delete']);
});
// 买家中心-服务订单
$router->group(['namespace' => 'Buyer', 'prefix' => 'buyer/service', 'middleware' => ['FrontAuthenticate']], function () use ($router) {
    $router->get('orders/', ['uses' => 'ServiceOrdersController@index', 'as' => 'web.seller.service.index']);
    $router->get('orders/{account_id:\d+}', ['uses' => 'ServiceOrdersController@show', 'as' => 'web.seller.service.show']);
    $router->post('orders/', ['uses' => 'ServiceOrdersController@store', 'as' => 'web.seller.service.store']);
    $router->put('orders/{account_id:\d+}', ['uses' => 'ServiceOrdersController@update', 'as' => 'web.seller.service.update']);
    $router->put('orders/close/{account_id:\d+}', ['uses' => 'ServiceOrdersController@close', 'as' => 'web.seller.service.close']);//取消服务订单
    $router->delete('orders/{account_id:\d+}', ['uses' => 'ServiceOrdersController@delete', 'as' => 'web.seller.service.delete']);
});
// 找资质
$router->group(['prefix' => 'qualified'], function () use ($router) {
    $router->get('/', ['uses' => 'QualifiedController@show', 'as' => 'web.qualified.show']);    // 找资质首页
    $router->get('/qualifiedProduct', ['uses' => 'ProductAttributesController@qualifiedProduct', 'as' => 'web.qualified.qualifiedProduct']);    // 找资质首页

    $router->get('/products', ['uses' => 'QualifiedController@products', 'as' => 'web.qualified.products']);    // 找资质首页
    $router->post('/getCate', ['uses' => 'QualifiedController@getCate', 'as' => 'web.qualified.catelist']);    // 获取找资质的分类列表
    $router->post('/getCateLevel/{attribute_id:\d+}', ['uses' => 'QualifiedController@getCateLevel', 'as' => 'web.qualified.getCateLevel']);    // 获取资质等级
});
//买家中心配单管理
$router->group(['namespace' => 'Buyer', 'prefix' => 'buyer/items', 'middleware' => ['FrontAuthenticate']], function () use ($router) {
    $router->get('/item_shop', ['uses' => 'ShopController@item_shop', 'as' => 'web.buyer.items.item_shop']);    //
    $router->get('/seller_shop/{id}', ['uses' => 'ShopController@seller_shop', 'as' => 'web.buyer.items.seller_shop']);    //
    $router->get('/', ['uses' => 'ItemsInformationController@index', 'as' => 'web.buyer.items.index']);    //配单管理首页
    $router->get('/buyer_index', ['uses' => 'ItemsInformationController@buyer_index', 'as' => 'web.buyer.items.buyer_index']);    //买家中心最新配单
    $router->post('/item_order', ['uses' => 'ItemsInformationController@item_order', 'as' => 'web.buyer.items.item_order']);    //支付页
    $router->post('/item_store', ['uses' => 'ItemsInformationController@item_store', 'as' => 'web.buyer.items.item_store']);    //去付款更新收货地址和发票

    $router->get('/{id}', ['uses' => 'ItemsInformationController@show', 'as' => 'web.buyer.items.show']);    //配单详情
    $router->post('/', ['uses' => 'ItemsInformationController@store', 'as' => 'web.buyer.items.store']);    //新增配单item_order
    $router->post('/get_payment', ['uses' => 'ItemsInformationController@getPaymentTotal', 'as' => 'web.buyer.items.getPaymentTotal']);    // 查询配单总额
});

//资质下单
$router->group(['namespace' => 'Buyer', 'prefix' => 'buyer/attribute', 'middleware' => ['FrontAuthenticate']], function () use ($router) {
    $router->post('/', ['uses' => 'OrderQualificationBidController@store', 'as' => 'web.buyer.attribute.orders.store']);   //创建订单
    $router->post('/{order_id:\d+}', ['uses' => 'OrderQualificationBidController@update', 'as' => 'web.buyer.attribute.orders.update']);    

});
// 找项目
$router->group(['prefix' => 'find/message'], function () use ($router) {
    $router->get('/', ['uses' => 'ProjectController@index', 'as' => 'web.find.index']);    // 找资质首页
    $router->get('/{id:\d+}', ['uses' => 'ProjectController@show', 'as' => 'web.find.show']);    // 找资质首页
});